<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ModifyProjectCompleteAt extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasColumn('project', 'complete_at')) {
            Schema::table('project', function (Blueprint $table) {
                $table->string('complete_at')->after('plan_complete_at')->default('')->comment('实际完成时间');
            });
        }
        if (!Schema::hasColumn('project', 'start_at')) {
            Schema::table('project', function (Blueprint $table) {
                $table->string('start_at')->after('plan_start_at')->default('')->comment('实际开始时间');
            });
        }
        if (!Schema::hasColumn('project', 'closed_at')) {
            Schema::table('project', function (Blueprint $table) {
                $table->string('closed_at')->after('complete_at')->default('')->comment('实际关闭时间');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
